package com.nodusk.config;

import com.nodusk.service.GenerateCodeService;
import freemarker.cache.ClassTemplateLoader;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author 倚栏听风
 * @date 2021-09-21 17:06
 */
@Configuration
public class FreemarkerConfig {
    @Bean
    public freemarker.template.Configuration freemarkerConfiguration() {
        freemarker.template.Configuration configuration = new freemarker.template.Configuration(freemarker.template.Configuration.VERSION_2_3_31);
        configuration.setTemplateLoader(new ClassTemplateLoader(GenerateCodeService.class, "/templates"));
        configuration.setDefaultEncoding("UTF-8");
        return configuration;
    }
}
